<template>
	<view class="recommend-goods-bar">
		<title-bar :title='title'></title-bar>
		<view class="goods-list" :style="{'background': background}">
			<navigator hover-class='none' :url="`/pagesGoods/goods-details/goods-details?id=${item.id}`" class="goods-item" v-for="(item, index) in array" :key="index">
				<goods-item-bar :title="item.title" :imgSrc="path + item.img" :price="item.price" :imgW="320" :imgH="320" >
					<slot></slot>
				</goods-item-bar>
			</navigator>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'RecommendGoodsBar',
		title: '推荐商品',
		props: {
			array: {
				type: Array,
				default: []
			},
			
			title: {
				type: String,
				default: ''
			},
			background: {
				type: String,
			}
		},
		data() {
			return {
				path: ''
			};
		},
		mounted() {
			this.path = this.$Path
		}
	}
</script>

<style lang="scss" scoped>
	.recommend-goods-bar{
		width: 100%;
		margin-top: 20upx;
		.goods-list{
			padding-top: 20upx;
			display: flex;
			flex-wrap: wrap;
			.goods-item{
				width: 50%;
				padding: 0 10upx;
				margin-bottom: 20upx;
				box-sizing: border-box;
			}
		}
	}
</style>
